function Get-StatSPTaxonomySession
{
    <# 
        .SYNOPSIS
            Returns a TaxonomySession object scoped to the Central Administration site.

        .DESCRIPTION
            Part of the SharePoint Total Automation Toolkit (STAT). This function returns a TaxonomySession object scoped to the Central Administration site.
 
        .EXAMPLE
            Get-StatSPTaxonomySessionForCA

    	.OUTPUTS
    		Microsoft.SharePoint.Taxonomy.TaxonomySession
    #>
    [CmdletBinding(DefaultParametersetName="Default")]
    param([parameter(ParameterSetName = "Default", 
                     Mandatory = $false,
                     ValueFromPipeline=$true,
                     ValueFromPipelineByPropertyName=$true, 
                     HelpMessage = "T")]
                     [string]$SiteCollectionUrl)

    if ($SiteCollectionUrl -eq "")
    {
        # If not site was specified then get a reference to the Central Administration site for the Global Taxonomy store
        $site = Get-SPWebApplication -IncludeCentralAdministration | Where {$_.IsAdministrationWebApplication} | Get-SPSite
    }
    else
    {
        $site = Get-SPSite $SiteCollectionUrl
    }

    if ($site -ne $null)
    {
        $taxonomySession = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
        return $taxonomySession
    }
    else
    {
        Write-Host "The site collection ($SiteCollectionUrl) could not be found." -ForegroundColor Red
        throw
    }
}